package json;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.junit.Test;

/**
 * Created by admin on 2017/11/13.
 */
public class JsonTest {
    @Test
    public void test01(){
        String result = "[{\n" +
                "    \"nickName\": \"路飞儿\",\n" +
                "    \"totalCount\": 2000,\n" +
                "    \"userId\": 901027853,\n" +
                "    \"lastTime\": 1510131139000,\n" +
                "    \"photo\": \"http://upcdn.file.m.mvbox.cn/upload/mobile/userPhoto/17/04/13/1704131555376e5cf3f47133408a_300.jpg\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"nickName\": \"小vv\",\n" +
                "        \"totalCount\": 10,\n" +
                "        \"userId\": 900001466,\n" +
                "        \"lastTime\": 1510044723000,\n" +
                "        \"photo\": \"http://upcdn.file.m.mvbox.cn/upload/mobile/userPhoto/17/04/18/170418164856e505498cf9264a30_300.jpg\"\n" +
                "    }]";
        JSONArray json = JSONArray.fromObject(result);
        System.out.println(json);
        System.out.println(json.getJSONObject(0).getLong("userId")+","+json.getJSONObject(0).getLong("totalCount"));
    }
}
